package com.future.north.service.impl;

import com.future.north.api.DubboMonitorService;
import com.future.north.manager.DubboMonitorManager;
import com.future.north.api.model.DubboMonitor;
import com.future.north.utils.ServiceResult;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DubboMonitorServiceImpl implements DubboMonitorService {
    @Autowired
    private DubboMonitorManager dubboMonitorManager;

    @Override
    public ServiceResult<Long> pageCount() {
        return new ServiceResult<>(dubboMonitorManager.pageCount());
    }

    @Override
    public ServiceResult<List<DubboMonitor>> pageList() {
        return new ServiceResult<>(dubboMonitorManager.pageList());
    }

    @Override
    public List<DubboMonitor> findAll() {
        return dubboMonitorManager.findAll();
    }

    @Override
    public Page<DubboMonitor> findByPage(int pageNo, int pageSize) {
        PageHelper.startPage(pageNo, pageSize);
        return dubboMonitorManager.findByPage();
    }
}
